using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using ClientGUI;

namespace ClientGUI.Widgets
{
    /// <summary>
    /// Used for invoke hacks.
    /// </summary>
    /// <param name="arg"></param>
    public delegate void StringMethodCall(String arg);

    /// <summary>
    /// Base class for all network dialogs.  Adds a status bar and a banner to a regular Form.
    /// </summary>
    public partial class NetworkDialog : Form
    {

        private MainForm my_main;
        /// <summary>
        /// For visual studio, ONLY
        /// </summary>
        public NetworkDialog()
        {
            InitializeComponent();
            label1.Text = "Custom Name";
            Text = "Custom Name";
        }
        /// <summary>
        /// Costructor
        /// </summary>
        /// <param name="lbl">banner</param>
        /// <param name="main">parent</param>
        public NetworkDialog(String lbl, MainForm main)
        {
            InitializeComponent();
            my_main = main;
            Text = lbl;
            label1.Text = lbl;
        }

        /// <summary>
        /// Set the status message
        /// </summary>
        /// <param name="msg">new status message</param>
        public void StatusMessage(string msg)
        {
            messageStatusbar1.StatusMessage(msg);
        }

        private void NetworkDialog_Paint(object sender, PaintEventArgs e)
        {
            Rectangle r = new Rectangle(0, 0, Width, label1.Location.Y + label1.Height + 10);
            Graphics g = e.Graphics;
            g.FillRectangle(Brushes.RoyalBlue, r);
        }

        /// <summary>
        /// Destroy used memory
        /// </summary>
        public new void Dispose()
        {
            if (messageStatusbar1.Status != "")
            {
                my_main.StatusMessage(messageStatusbar1.Status);
            }
            messageStatusbar1.Dispose();
            base.Dispose();
        }
    }
}